<?php

namespace privateClass\Auth;

class Auth {
	
	public function __construct() {
	}
	
	public function get_auth($app_id = '', $app_code = '', $access_secret_key = '') {
		$result = FALSE;
		//检查config和访问app_code的对应关系
		if ($app_id == '' || $app_code == '' || $access_secret_key == '') ;
		else {
			$response = _curl(\Yaf\Registry::get('config')->api->auth->authorize.'?|'.$access_secret_key.'&scope=AUTHORIZE');
			if ($response['status_code'] == 200) {
				$result = json_decode($response['response'],TRUE);
				if ($app_id != $result['datas']['app_id']) {
					throw new \Exception();
				} else $result = $result['datas'];
			}
		}
		return $result;
	}
	
}

?>